<?php

class common

{ 

function sendMail($name,$from="",$to,$cc,$subject,$content) {

include("../mailer/class.phpmailer.php");

include("../mailer/class.smtp.php");

$mail = new PHPMailer();

$mail->IsSMTP(); // telling the class to use SMTP bat chuc nang SMTP

$mail->SMTPAuth = TRUE; //bat chuc nang dang nhap vao SMTP

//$mail->SMTPSecure = 'ssl';

$mail->Host = "thietkewebsitetop.com";//SMTP server

$mail->Port = 25;

$mail->Username = "tu@thietkewebsitetop.com";

$mail->Password= "Dinhtu1110";



//$mail->Port = 465;


$mail->From = $from;//mail nguoi gui

$mail->FromName = $name;//ten nguoi gui

$mail->CharSet ="utf-8";

$mail->AddAddress($to);//$to dia chi mail ma ban muon gui toi

$mail->AddCC($cc);

$mail->IsHTML(true);

$mail->WordWrap = 50;

$mail->Subject = "$subject";

$mail->Body = "$content";


$str = "";

if(!$mail->Send())

{

$str = $mail->ErrorInfo;

}

else

{

$str = "2";

}


return $str;

}

}

?>
